package com.dragon.modules.yuegou.enums.code;

import com.dragon.common.constant.enums.IBusinessCode;

import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * 会员业务状态码
 * 
 * @author 刘武
 *
 */
public enum MemberCode implements IBusinessCode {
	MEMBER_TURNTABLE_NOTFOUND(13000, "未配置积分大转盘"),
	/**
	 * 会员不存在
	 */
	MEMBER_NOT_EXIST(13001, "会员不存在"),

	/**
	 * 等级名称已存在
	 */
	MEMBER_LEVEL_EXIST(13002, "等级名称已存在"),

	MEMBER_MOBILE_EXIST(13003, "会员手机不正确"),

	MEMBER_LIFT_RULES(13004, "会员等级升降规则说明已存在"),
	
	PASSWORD_IS_EMPTY(13005, "登陆密码不能为空"),

	MEMBER_NOT_REGISTERED(13006, "会员不存在,请注册"),

	MEMBER_EXIST(13007, "会员已存在,请勿重复注册"),

	CART_NOT_EXIST(13008, "购物车不存在"),
	
	CANT_DELETE_DEFAULT_ADDRESS(13009, "不能删除默认地址"),
	
	MEMBER_POINT_INCORRECT_DATA(13010,"%s"),

	WRONG_RECEIVING_ADDRESS(13011,"获取不到该地址，请填写正确的收货地址！"),
	
	THIS_ROOM_HAS_NOT_BEEN_HANDED_IN_PLEASE_CONTACT_THE_ADMINISTRATOR(13012,"该房间未交房请联系管理员"),
	
	MEMBER_BOUND_THE_ROOM(13013,"会员已绑定该房间,请勿重复绑定"),
	EQUITY_DESCRIPTION_EQUITY_PICTURE_CAN_NOT_BE_EMPTY(13014,"权益说明、权益图片不能都为空"),
	BENEFIT_UNSUPPRESSIBLE(13015,"权益已被应用，无法删除"),

	MEMBER_GROW_CONFIG(13016, "成长值行为已经存在,请勿重复配置"),
	MEMBER_TURNTABLE_NOT_START(13018, "当前抽奖活动未开始"),
	MEMBER_TURNTABLE_END(13019, "当前抽奖活动已结束"),
	MEMBER_TURNTABLE_EXTRACT_EXIST(13020, "您的操作过于频繁"),
	MEMBER_TURNTABLE_SKU_NOTFOUND(13021, "未找到中奖奖品"),
	MEMBER_TURNTABLE_APP_NOTFOUND(13022, "活动不属于当前应用！"),
	MEMBER_TURNTABLE_EXIST(13023, "显示位置已经配置了积分大转盘！"),
	ENABLE_STATUS_CAN_NOT_DELETE(13024, "启用状态无法删除！"),
	PRO_DISCOUNT_ID_ERROR(13025, "商品折扣ID错误！"),
	PRO_MAGNIFICATION_POINT_ID_ERROR(13026, "多倍积分ID错误！"),
	MEMBER_TURNTABLE_NO_PRIZE(13027, "奖品已经被抽完了！"),
	MEMBER_TURNTABLE_TOYDAY_MAX_EXTRACT_PRIZE(13028, "您今日抽奖次数已经达到最大次数！"),
	MEMBER_TURNTABLE_MAX_PRIZE(13029, "您的抽奖次数已经达到最大次数！"),
	MEMBER_PLATFORM_MERCHATMAXE(13030, "商户分摊加平台分摊必须等于1！"),
	MEMBER_TURNTABLE_NOTFOUND1(13031, "未配置积分大转盘"),

	MEMBER_ID_IS_EMPTY(13032, "会员id不能为空"),
	/**
	 * 状态码说明
	 */
	TODO(13000, "提示消息");

	private final Integer code;

	private final String message;

	private MemberCode(Integer code, String message) {
		this.code = code;
		this.message = message;
	}

	public Integer getCode() {
		return code;
	}

	public String getMessage() {
		return message;
	}

	/**
	 * 把code转化为ResponseCode枚举
	 * 
	 * @param code 代码
	 * @return
	 */
	public static MemberCode from(Integer code) {
		if (code == null) {
			return null;
		}
		return CODE_MAP.get(code);
	}

	/**
	 * Code Map for ResponseCode
	 */
	private static final Map<Integer, MemberCode> CODE_MAP = Stream.of(MemberCode.values())
			.collect(Collectors.toMap(MemberCode::getCode, e -> e));
	
}
